// 使用方法
/**
    1. 在页面添加以下节点内容 
    <page-frame 
       :showPageRefresh="showPageRefresh"
       v-model:refresh-loading="pageRefreshLoading"
       @onRefresh="onRefresh"
    ></page-frame>
  2. 
    import pageRefresh from '@/views/mixins/page-refresh'
    export default {
        mixins: [pageBase, pageRefresh],  
    },
  2. 在刷新方法中调用 查询语句，并设置对应的状态 
    onRefresh() {
        that.pageRefreshLoading = true

        //查询完成后
        that.pageRefreshLoading = false
          
    }

 */

/**
 * 下拉刷新
 */
export default {
  data() {
    return {
      /**
       * 頁面刷新加載動畫標識
       */
      pageRefreshLoading: false,
      /**
       * 使用頁面刷新
       */
      showPageRefresh: true
    }
  },
  methods: {
    /**
     * 刷新方法
     */
    onRefresh() {
      const that = this as any
      that.pageRefreshLoading = true
      const timeoutId = setTimeout(() => {
        if (that.pageRefreshLoading) {
          that.pageRefreshLoading = false
          clearTimeout(timeoutId)
        }
      }, 3000)
    }
  },
  created() {
  }
}
